package hadoop.ch08.v17124080106;

import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

public class SogouMain  {
    public static void main(String[] args) throws Exception {
        Job job = Job.getInstance();
        job.setJarByClass( SogouMain .class);
        job.setMapperClass(SougouMapper.class);
        job.setMapOutputKeyClass(NullWritable.class);
        job.setMapOutputValueClass(Sogou.class);
        job.setPartitionerClass(SougouPartitioner.class);
        job.setNumReduceTasks(2);
        job.setReducerClass(SougouReducer.class);
        job.setOutputKeyClass(NullWritable.class);
        job.setOutputValueClass(Text.class);
        FileInputFormat.setInputPaths(job, new Path(args[0]));
        FileOutputFormat.setOutputPath(job, new Path(args[1]));
        job.waitForCompletion(true);

    }
}
